package cn.piesat.scanning.business.xz.service.snwimpl;

import cn.piesat.scanning.business.xz.service.BuildAlgorithmTaskService;
import cn.piesat.scanning.business.xz.single.AlgorithmTaskPathParam;
import cn.piesat.scanning.business.xz.single.AlgorithmTaskRuleParam;
import cn.piesat.scanning.dto.HtScanningMetadataDTO;
import cn.piesat.scanning.service.HtScanningMetadataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @author Ming
 * @version 1.0
 * @description: TODO
 * @date 2023/12/18 13:48
 */
@Service
public class Build02_SDFCServiceImpl implements BuildAlgorithmTaskService {
    @Autowired
    private HtScanningMetadataService htScanningMetadataService;
    @Override
    public Map<String, Object> initAlgorithmParams(String adsType, String primaryFile, String filePath, AlgorithmTaskRuleParam taskRuleParam, AlgorithmTaskPathParam taskPathParam,
                                                   Map<String, Integer> indexParams, String fileDate, String scanningPath,HtScanningMetadataDTO htScanningMetadataDTO) {
        Map<String, Object> algorithmParams = new HashMap<>();
        //FY3D_MERSI_GBAL_L1B_GLL_20230701_0910_1000M.NC
        Map<String, Object> params = new HashMap<>();
        //TODO 无匹配数据,预报数据先写死时间
        LinkedList<HtScanningMetadataDTO> TMP = htScanningMetadataService.findMetaDataDto("202311270800", "L0", "NWGD",
                "SPCC-TMP", "ALL", "GRB2");
        LinkedList<HtScanningMetadataDTO> ER03 = htScanningMetadataService.findMetaDataDto("202311262000", "L0", "NWGD",
                "SPCC-ER03", "ALL", "GRB2");

        params.put("primaryFile", primaryFile);
        params.put("tempFile",  taskPathParam.getParameter02()+TMP.getLast().getFilePath());
        params.put("tpFile", taskPathParam.getParameter02()+ER03.getLast().getFilePath());
        params.put("auxpathFile", taskPathParam.getParameter03());
        params.put("sysname", taskPathParam.getParameter04());
        params.put("prod_name", taskPathParam.getParameter05());
        params.put("sr_coff", taskPathParam.getParameter06());
        params.put("sh_coff", taskPathParam.getParameter07());
        algorithmParams.put("parameter00", adsType);
        algorithmParams.put("parameter01", params);
        return algorithmParams;
    }
}
